package com.jvm123.blog.servlet

import javax.servlet.annotation.WebListener
import javax.servlet.http.HttpSession
import javax.servlet.http.HttpSessionEvent
import javax.servlet.http.HttpSessionListener

/**
 *
 * @author yawn http://jvm123.com
 *     2019/11/4 11:33
 */
@WebListener
class SessionListener implements HttpSessionListener {

    @Override
    void sessionCreated(HttpSessionEvent sessionEvent) {
        HttpSession session = sessionEvent.getSession()
        System.out.print("创建了session：" + session.getId())
    }

    @Override
    void sessionDestroyed(HttpSessionEvent sessionEvent) {
        HttpSession session = sessionEvent.getSession()
        System.out.print("销毁了session：" + session.getId())
    }
}
